// generate file: tag=schema_go: time=20220627 10:16:46.068
package sample

// imports

import (
	"gitee.com/zhongguo168a/gocodes/datax/reflectx"
)

// init

// contents

type SampleClassRef struct {
	ParentRef
}

func (ref *SampleClassRef) RefType() string {
	return "sampleClass"
}

func (ref *SampleClassRef) RefNew() reflectx.IRefObject {
	return &SampleClass{}
}

func (ref *SampleClassRef) RefHas(field string) bool {
	switch field {
	case "String":
		return true
	case "int32":
		return true
	case "Float32":
		return true
	case "Enum":
		return true
	case "Enum2":
		return true
	case "Enum3":
		return true
	case "SubEnum":
		return true
	case "Class1":
		return true
	case "Sub":
		return true
	case "Array":
		return true
	case "ArraySt":
		return true
	case "Map":
		return true
	case "MapSt":
		return true
	case "Any":
		return true

	}

	return ref.ParentRef.RefHas(field)
}

func (ref *SampleClassRef) RefGet(obj reflectx.IRefObject, field string) (interface{}, bool) {
	target := obj.(*SampleClass)
	_ = target
	switch field {
	case "String":
		return target.String, false
	case "int32":
		return target.Int32, false
	case "Float32":
		return target.Float32, false
	case "Enum":
		return target.Enum, false
	case "Enum2":
		return target.Enum2, false
	case "Enum3":
		return target.Enum3, false
	case "SubEnum":
		return target.SubEnum, false
	case "Class1":
		val := target.Class1
		return val, val == nil
	case "Sub":
		val := target.Sub
		return val, val == nil
	case "Array":
		val := target.Array
		return val, val == nil
	case "ArraySt":
		val := target.ArraySt
		return val, val == nil
	case "Map":
		val := target.Map
		return val, val == nil
	case "MapSt":
		val := target.MapSt
		return val, val == nil
	case "Any":
		val := target.Any
		return val, val == nil

	}

	return ref.ParentRef.RefGet(&target.Parent, field)
}

func (ref *SampleClassRef) RefSet(obj reflectx.IRefObject, field string, val interface{}) {
	target := obj.(*SampleClass)
	_ = target
	switch field {
	case "String":
		target.String = val.(string)
	case "int32":
		target.Int32 = val.(int)
	case "Float32":
		target.Float32 = val.(float64)
	case "Enum":
		target.Enum = val.(int)
	case "Enum2":
		target.Enum2 = val.(uint)
	case "Enum3":
		target.Enum3 = val.(int)
	case "SubEnum":
		target.SubEnum = val.(int)
	case "Class1":
		target.Class1 = val.(*Class1)
	case "Sub":
		target.Sub = val.(*Sub)
	case "Array":
		target.Array = val.([]int)
	case "ArraySt":
		target.ArraySt = val.([]*Sub)
	case "Map":
		target.Map = val.(map[string]int)
	case "MapSt":
		target.MapSt = val.(map[string]*Class1)
	case "Any":
		target.Any = val

	default:
		{
			ref.ParentRef.RefSet(&target.Parent, field, val)
		}

	}

}

func (ref *SampleClassRef) RefSliceLength(obj reflectx.IRefObject, field string) int {
	target := obj.(*SampleClass)
	_ = target
	switch field {
	case "Array":
		return len(target.Array)
	case "ArraySt":
		return len(target.ArraySt)

	}

	return 0
}

func (ref *SampleClassRef) RefSliceGet(obj reflectx.IRefObject, field string, index int) (interface{}, bool) {
	target := obj.(*SampleClass)
	_ = target
	switch field {
	case "Array":
		val := target.Array[index]
		return val, false
	case "ArraySt":
		val := target.ArraySt[index]
		return val, val == nil

	}

	return nil, false
}

func (ref *SampleClassRef) RefSliceSet(obj reflectx.IRefObject, field string, index int, val interface{}) {
	target := obj.(*SampleClass)
	_ = target
	switch field {
	case "Array":
		target.Array[index] = val.(int)
	case "ArraySt":
		target.ArraySt[index] = val.(*Sub)

	}

}

func (ref *SampleClassRef) RefSliceNew(field string, len int, cap int) (r interface{}) {
	switch field {
	case "Array":
		r = make([]int, len, cap)
	case "ArraySt":
		r = make([]*Sub, len, cap)

	}

	return
}

func (ref *SampleClassRef) RefMapGet(obj reflectx.IRefObject, field string, key string) (interface{}, bool) {
	target := obj.(*SampleClass)
	_ = target
	switch field {
	case "Map":
		val := target.Map[key]
		return val, false
	case "MapSt":
		val := target.MapSt[key]
		return val, val == nil

	}

	return nil, false
}

func (ref *SampleClassRef) RefMapSet(obj reflectx.IRefObject, field string, key string, val interface{}) {
	target := obj.(*SampleClass)
	_ = target
	switch field {
	case "Map":
		target.Map[key] = val.(int)
	case "MapSt":
		target.MapSt[key] = val.(*Class1)

	}

}

func (ref *SampleClassRef) RefMapNew(field string) interface{} {
	switch field {
	case "Map":
		return make(map[string]int)
	case "MapSt":
		return make(map[string]*Class1)

	}

	return nil
}

func (ref *SampleClassRef) RefMapKeys(obj reflectx.IRefObject, field string) (keys []string) {
	target := obj.(*SampleClass)
	switch field {
	case "Map":
		for key := range target.Map {
			keys = append(keys, key)
		}
		return
	case "MapSt":
		for key := range target.MapSt {
			keys = append(keys, key)
		}
		return

	}

	return
}

type ParentRef struct {
}

func (ref *ParentRef) RefType() string {
	return "Parent"
}

func (ref *ParentRef) RefNew() reflectx.IRefObject {
	return &Parent{}
}

func (ref *ParentRef) RefHas(field string) bool {
	switch field {
	case "Bool":
		return true

	}

	return false
}

func (ref *ParentRef) RefGet(obj reflectx.IRefObject, field string) (interface{}, bool) {
	target := obj.(*Parent)
	_ = target
	switch field {
	case "Bool":
		return target.Bool, false

	}

	return nil, false
}

func (ref *ParentRef) RefSet(obj reflectx.IRefObject, field string, val interface{}) {
	target := obj.(*Parent)
	_ = target
	switch field {
	case "Bool":
		target.Bool = val.(bool)

	default:
		{

		}

	}

}

type Class1Ref struct {
}

func (ref *Class1Ref) RefType() string {
	return "Class1"
}

func (ref *Class1Ref) RefNew() reflectx.IRefObject {
	return &Class1{}
}

func (ref *Class1Ref) RefHas(field string) bool {
	switch field {
	case "Int":
		return true
	case "String":
		return true
	case "Enum3":
		return true

	}

	return false
}

func (ref *Class1Ref) RefGet(obj reflectx.IRefObject, field string) (interface{}, bool) {
	target := obj.(*Class1)
	_ = target
	switch field {
	case "Int":
		return target.Int, false
	case "String":
		return target.String, false
	case "Enum3":
		return target.Enum3, false

	}

	return nil, false
}

func (ref *Class1Ref) RefSet(obj reflectx.IRefObject, field string, val interface{}) {
	target := obj.(*Class1)
	_ = target
	switch field {
	case "Int":
		target.Int = val.(int)
	case "String":
		target.String = val.(string)
	case "Enum3":
		target.Enum3 = val.(int)

	default:
		{

		}

	}

}

type SubRef struct {
	Sub1Ref
}

func (ref *SubRef) RefType() string {
	return "Sub"
}

func (ref *SubRef) RefNew() reflectx.IRefObject {
	return &Sub{}
}

func (ref *SubRef) RefHas(field string) bool {
	switch field {
	case "Bool":
		return true

	}

	return ref.Sub1Ref.RefHas(field)
}

func (ref *SubRef) RefGet(obj reflectx.IRefObject, field string) (interface{}, bool) {
	target := obj.(*Sub)
	_ = target
	switch field {
	case "Bool":
		return target.Bool, false

	}

	return ref.Sub1Ref.RefGet(&target.Sub1, field)
}

func (ref *SubRef) RefSet(obj reflectx.IRefObject, field string, val interface{}) {
	target := obj.(*Sub)
	_ = target
	switch field {
	case "Bool":
		target.Bool = val.(bool)

	default:
		{
			ref.Sub1Ref.RefSet(&target.Sub1, field, val)
		}

	}

}

func (ref *SubRef) RefSliceLength(obj reflectx.IRefObject, field string) int {
	target := obj.(*Sub)
	_ = target
	return ref.Sub1Ref.RefSliceLength(&target.Sub1, field)
}

func (ref *SubRef) RefSliceGet(obj reflectx.IRefObject, field string, index int) (interface{}, bool) {
	target := obj.(*Sub)
	_ = target
	return ref.Sub1Ref.RefSliceGet(&target.Sub1, field, index)
}

func (ref *SubRef) RefSliceSet(obj reflectx.IRefObject, field string, index int, val interface{}) {
	target := obj.(*Sub)
	_ = target
	ref.Sub1Ref.RefSliceSet(&target.Sub1, field, index, val)
}

func (ref *SubRef) RefSliceNew(field string, len int, cap int) (r interface{}) {
	return ref.Sub1Ref.RefSliceNew(field, len, cap)
}

func (ref *SubRef) RefMapGet(obj reflectx.IRefObject, field string, key string) (interface{}, bool) {
	target := obj.(*Sub)
	_ = target
	return ref.Sub1Ref.RefMapGet(&target.Sub1, field, key)
}

func (ref *SubRef) RefMapSet(obj reflectx.IRefObject, field string, key string, val interface{}) {
	target := obj.(*Sub)
	_ = target
	ref.Sub1Ref.RefMapSet(&target.Sub1, field, key, val)
}

func (ref *SubRef) RefMapNew(field string) interface{} {
	return ref.Sub1Ref.RefMapNew(field)
}

func (ref *SubRef) RefMapKeys(obj reflectx.IRefObject, field string) (keys []string) {
	target := obj.(*Sub)
	return ref.Sub1Ref.RefMapKeys(&target.Sub1, field)
}

type Sub1Ref struct {
}

func (ref *Sub1Ref) RefType() string {
	return "Sub1"
}

func (ref *Sub1Ref) RefNew() reflectx.IRefObject {
	return &Sub1{}
}

func (ref *Sub1Ref) RefHas(field string) bool {
	switch field {
	case "Map":
		return true
	case "Array":
		return true

	}

	return false
}

func (ref *Sub1Ref) RefGet(obj reflectx.IRefObject, field string) (interface{}, bool) {
	target := obj.(*Sub1)
	_ = target
	switch field {
	case "Map":
		val := target.Map
		return val, val == nil
	case "Array":
		val := target.Array
		return val, val == nil

	}

	return nil, false
}

func (ref *Sub1Ref) RefSet(obj reflectx.IRefObject, field string, val interface{}) {
	target := obj.(*Sub1)
	_ = target
	switch field {
	case "Map":
		target.Map = val.(map[string]string)
	case "Array":
		target.Array = val.([]string)

	default:
		{

		}

	}

}

func (ref *Sub1Ref) RefSliceLength(obj reflectx.IRefObject, field string) int {
	target := obj.(*Sub1)
	_ = target
	switch field {
	case "Array":
		return len(target.Array)

	}

	return 0
}

func (ref *Sub1Ref) RefSliceGet(obj reflectx.IRefObject, field string, index int) (interface{}, bool) {
	target := obj.(*Sub1)
	_ = target
	switch field {
	case "Array":
		val := target.Array[index]
		return val, false

	}

	return nil, false
}

func (ref *Sub1Ref) RefSliceSet(obj reflectx.IRefObject, field string, index int, val interface{}) {
	target := obj.(*Sub1)
	_ = target
	switch field {
	case "Array":
		target.Array[index] = val.(string)

	}

}

func (ref *Sub1Ref) RefSliceNew(field string, len int, cap int) (r interface{}) {
	switch field {
	case "Array":
		r = make([]string, len, cap)

	}

	return
}

func (ref *Sub1Ref) RefMapGet(obj reflectx.IRefObject, field string, key string) (interface{}, bool) {
	target := obj.(*Sub1)
	_ = target
	switch field {
	case "Map":
		val := target.Map[key]
		return val, false

	}

	return nil, false
}

func (ref *Sub1Ref) RefMapSet(obj reflectx.IRefObject, field string, key string, val interface{}) {
	target := obj.(*Sub1)
	_ = target
	switch field {
	case "Map":
		target.Map[key] = val.(string)

	}

}

func (ref *Sub1Ref) RefMapNew(field string) interface{} {
	switch field {
	case "Map":
		return make(map[string]string)

	}

	return nil
}

func (ref *Sub1Ref) RefMapKeys(obj reflectx.IRefObject, field string) (keys []string) {
	target := obj.(*Sub1)
	switch field {
	case "Map":
		for key := range target.Map {
			keys = append(keys, key)
		}
		return

	}

	return
}

type M1RespRef struct {
}

func (ref *M1RespRef) RefType() string {
	return "M1Resp"
}

func (ref *M1RespRef) RefNew() reflectx.IRefObject {
	return &M1Resp{}
}

func (ref *M1RespRef) RefHas(field string) bool {
	switch field {

	}

	return false
}

func (ref *M1RespRef) RefGet(obj reflectx.IRefObject, field string) (interface{}, bool) {
	target := obj.(*M1Resp)
	_ = target
	switch field {

	}

	return nil, false
}

func (ref *M1RespRef) RefSet(obj reflectx.IRefObject, field string, val interface{}) {
	target := obj.(*M1Resp)
	_ = target
	switch field {

	default:
		{

		}

	}

}

type M1ArgsRef struct {
}

func (ref *M1ArgsRef) RefType() string {
	return "M1Args"
}

func (ref *M1ArgsRef) RefNew() reflectx.IRefObject {
	return &M1Args{}
}

func (ref *M1ArgsRef) RefHas(field string) bool {
	switch field {

	}

	return false
}

func (ref *M1ArgsRef) RefGet(obj reflectx.IRefObject, field string) (interface{}, bool) {
	target := obj.(*M1Args)
	_ = target
	switch field {

	}

	return nil, false
}

func (ref *M1ArgsRef) RefSet(obj reflectx.IRefObject, field string, val interface{}) {
	target := obj.(*M1Args)
	_ = target
	switch field {

	default:
		{

		}

	}

}
